package com.leetcode.greedy;

/**
 * @author Dennis Li
 * @date 2020/7/23 21:58
 */
public class MaxSubArray_53 {

    public int maxSubArray(int[] nums) {
        int sum = 0, max = Integer.MIN_VALUE;
        for (int num : nums) {
            sum = Math.max(sum + num, num);
            max = Math.max(max, sum);
        }
        return max;
    }
}
